\(\int \frac {\cot ^2(x)}{a+a \cos (x)} \, dx\) [6]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 13, antiderivative size = 30 \[ \int \frac {\cot ^2(x)}{a+a \cos (x)} \, dx=-\frac {\cot ^3(x)}{3 a}-\frac {\csc (x)}{a}+\frac {\csc ^3(x)}{3 a} \]

[Out]

-1/3*cot(x)^3/a-csc(x)/a+1/3*csc(x)^3/a

Rubi [A] (verified)

Time = 0.10 (sec) , antiderivative size = 30, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.308, Rules used = {2785, 2687, 30, 2686} \[ \int \frac {\cot ^2(x)}{a+a \cos (x)} \, dx=-\frac {\cot ^3(x)}{3 a}+\frac {\csc ^3(x)}{3 a}-\frac {\csc (x)}{a} \]

[In]

Int[Cot[x]^2/(a + a*Cos[x]),x]

[Out]

-1/3*Cot[x]^3/a - Csc[x]/a + Csc[x]^3/(3*a)

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 2686

Int[((a_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a/f, Subst[
Int[(a*x)^(m - 1)*(-1 + x^2)^((n - 1)/2), x], x, Sec[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n -
1)/2] &&  !(IntegerQ[m/2] && LtQ[0, m, n + 1])

Rule 2687

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[1/f, Subst[Int[(b*x)
^n*(1 + x^2)^(m/2 - 1), x], x, Tan[e + f*x]], x] /; FreeQ[{b, e, f, n}, x] && IntegerQ[m/2] &&  !(IntegerQ[(n
- 1)/2] && LtQ[0, n, m - 1])

Rule 2785

Int[((g_.)*tan[(e_.) + (f_.)*(x_)])^(p_.)/((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Dist[1/a, Int[S
ec[e + f*x]^2*(g*Tan[e + f*x])^p, x], x] - Dist[1/(b*g), Int[Sec[e + f*x]*(g*Tan[e + f*x])^(p + 1), x], x] /;
FreeQ[{a, b, e, f, g, p}, x] && EqQ[a^2 - b^2, 0] && NeQ[p, -1]

Rubi steps \begin{align*} \text {integral}& = -\frac {\int \cot ^3(x) \csc (x) \, dx}{a}+\frac {\int \cot ^2(x) \csc ^2(x) \, dx}{a} \\ & = \frac {\text {Subst}\left (\int x^2 \, dx,x,-\cot (x)\right )}{a}+\frac {\text {Subst}\left (\int \left (-1+x^2\right ) \, dx,x,\csc (x)\right )}{a} \\ & = -\frac {\cot ^3(x)}{3 a}-\frac {\csc (x)}{a}+\frac {\csc ^3(x)}{3 a} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.13 (sec) , antiderivative size = 25, normalized size of antiderivative = 0.83 \[ \int \frac {\cot ^2(x)}{a+a \cos (x)} \, dx=\frac {(-3-4 \cos (x)+\cos (2 x)) \csc (x)}{6 a (1+\cos (x))} \]

[In]

Integrate[Cot[x]^2/(a + a*Cos[x]),x]

[Out]

((-3 - 4*Cos[x] + Cos[2*x])*Csc[x])/(6*a*(1 + Cos[x]))

Maple [A] (verified)

Time = 0.46 (sec) , antiderivative size = 29, normalized size of antiderivative = 0.97

method result size
default \(\frac {\frac {\left (\tan ^{3}\left (\frac {x}{2}\right )\right )}{3}-2 \tan \left (\frac {x}{2}\right )-\frac {1}{\tan \left (\frac {x}{2}\right )}}{4 a}\) \(29\)
risch \(-\frac {2 i \left (3 \,{\mathrm e}^{3 i x}+3 \,{\mathrm e}^{2 i x}+{\mathrm e}^{i x}-1\right )}{3 \left ({\mathrm e}^{i x}+1\right )^{3} a \left ({\mathrm e}^{i x}-1\right )}\) \(46\)

[In]

int(cot(x)^2/(a+cos(x)*a),x,method=_RETURNVERBOSE)

[Out]

1/4/a*(1/3*tan(1/2*x)^3-2*tan(1/2*x)-1/tan(1/2*x))

Fricas [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 24, normalized size of antiderivative = 0.80 \[ \int \frac {\cot ^2(x)}{a+a \cos (x)} \, dx=\frac {\cos \left (x\right )^{2} - 2 \, \cos \left (x\right ) - 2}{3 \, {\left (a \cos \left (x\right ) + a\right )} \sin \left (x\right )} \]

[In]

integrate(cot(x)^2/(a+a*cos(x)),x, algorithm="fricas")

[Out]

1/3*(cos(x)^2 - 2*cos(x) - 2)/((a*cos(x) + a)*sin(x))

Sympy [F]

\[ \int \frac {\cot ^2(x)}{a+a \cos (x)} \, dx=\frac {\int \frac {\cot ^{2}{\left (x \right )}}{\cos {\left (x \right )} + 1}\, dx}{a} \]

[In]

integrate(cot(x)**2/(a+a*cos(x)),x)

[Out]

Integral(cot(x)**2/(cos(x) + 1), x)/a

Maxima [A] (verification not implemented)

none

Time = 0.22 (sec) , antiderivative size = 42, normalized size of antiderivative = 1.40 \[ \int \frac {\cot ^2(x)}{a+a \cos (x)} \, dx=-\frac {\frac {6 \, \sin \left (x\right )}{\cos \left (x\right ) + 1} - \frac {\sin \left (x\right )^{3}}{{\left (\cos \left (x\right ) + 1\right )}^{3}}}{12 \, a} - \frac {\cos \left (x\right ) + 1}{4 \, a \sin \left (x\right )} \]

[In]

integrate(cot(x)^2/(a+a*cos(x)),x, algorithm="maxima")

[Out]

-1/12*(6*sin(x)/(cos(x) + 1) - sin(x)^3/(cos(x) + 1)^3)/a - 1/4*(cos(x) + 1)/(a*sin(x))

Giac [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.23 \[ \int \frac {\cot ^2(x)}{a+a \cos (x)} \, dx=\frac {a^{2} \tan \left (\frac {1}{2} \, x\right )^{3} - 6 \, a^{2} \tan \left (\frac {1}{2} \, x\right )}{12 \, a^{3}} - \frac {1}{4 \, a \tan \left (\frac {1}{2} \, x\right )} \]

[In]

integrate(cot(x)^2/(a+a*cos(x)),x, algorithm="giac")

[Out]

1/12*(a^2*tan(1/2*x)^3 - 6*a^2*tan(1/2*x))/a^3 - 1/4/(a*tan(1/2*x))

Mupad [B] (verification not implemented)

Time = 14.04 (sec) , antiderivative size = 35, normalized size of antiderivative = 1.17 \[ \int \frac {\cot ^2(x)}{a+a \cos (x)} \, dx=\frac {4\,{\cos \left (\frac {x}{2}\right )}^4-8\,{\cos \left (\frac {x}{2}\right )}^2+1}{12\,a\,{\cos \left (\frac {x}{2}\right )}^3\,\sin \left (\frac {x}{2}\right )} \]

[In]

int(cot(x)^2/(a + a*cos(x)),x)

[Out]

(4*cos(x/2)^4 - 8*cos(x/2)^2 + 1)/(12*a*cos(x/2)^3*sin(x/2))